
package me.zhengjie.modules.gis.repositorySmart;

import me.zhengjie.modules.gis.domainSmart.MesAreaData;
import me.zhengjie.modules.gis.domainSmart.SmartWeighbridgeData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface SmartWeighbridgeDataRepository extends JpaRepository<SmartWeighbridgeData, Long>, JpaSpecificationExecutor<SmartWeighbridgeData> {


    @Query(value="select distinct source_unit as sourceUnit, area, transport_unit_inner_code as transportUnitInnerCode from vortex_szzszy " +
            "where transport_unit_inner_code = 1 and (data_operate = 0 or data_operate = 1)",
            nativeQuery = true
    )
    List<MesAreaData> getSourceUnitList();

    @Query(value="select distinct handle_unit as handleUnit, transport_unit_inner_code as transportUnitInnerCode from vortex_szzszy " +
            "where transport_unit_inner_code = 0 and (data_operate = 0 or data_operate = 1)",
            nativeQuery = true
    )
    List<MesAreaData> getHandleUnitList();

}